#!/bin/sh
while true
do
 aaa=0
 aaa=`ps -ef | grep sbin/tinyproxy | grep -v "grep" |wc |awk '{print $1}'`
 if [ $aaa -lt 10 ]
 then
  rm -rf /var/log/tinyproxy/*
  echo "----------------------------------" >> /etc/tinyproxy/run.log
  echo "`date` RUN NUM: $aaa" >> /etc/tinyproxy/run.log
  service tinyproxy restart
  echo "`date` RESTART RUN" >> /etc/tinyproxy/run.log 
 else
  echo "`date` RUN NUM: $aaa" >> /etc/tinyproxy/run.log 
 fi
sleep 300
done

